#ifndef __M_LEVEL_H__
#define __M_LEVEL_H__

namespace logger
{
    class LogLevel
    {
    public:
        enum class value
        {
            UNKONW = 0,
            DEBUG,
            INFO,
            WARN,
            ERROR,
            FATAL,
            OFF
        };
        static const char *ToString(LogLevel::value l)
        {
            switch (l){
#define TOSTRING(name) #name  //转为字符串字面量
            case LogLevel::value::DEBUG:
                return TOSTRING(DEBUG);
            case LogLevel::value::INFO:
                return TOSTRING(INFO);
            case LogLevel::value::WARN:
                return TOSTRING(WARN);
            case LogLevel::value::ERROR:
                return TOSTRING(ERROR);
            case LogLevel::value::FATAL:
                return TOSTRING(FATAL);
            case LogLevel::value::OFF:
                return TOSTRING(OFF);
#undef TOSTRING
            default:
                return "UNKNOW";
            }
            return "UNKNOW";
        }
    };
}
#endif